#ifndef __BITMAP_H__
#define __BITMAP_H__

#include "miniui/minitypes.h"
#include "skia/SkBitmap.h"
#include "base/object.h"

namespace MiniUI
{

class Graphis;

class Bitmap : public Object,
               public Creator<Bitmap>
{
    friend class Graphics;
public:
    Bitmap();
    virtual ~Bitmap();

    void Rebuild(const Type::MiniSize& size, lpvoid pBits);
    void Rebuild(const Type::MiniSize& size);
    //Get Info
    lpvoid GetBytes() const;
    uint GetWidthBytes() const;
    void GetBitmapSize(Type::MiniSize& size) const;
    void* GetBitmapDevice() const;
    //Lock & Unlock
    lpvoid LockBits(const Type::MiniRect& rect);
    void UnlockBits();
private:
	void Destroy();
private:
    bool m_bInnerBits;  //decide the m_pBits is inited from inside or outside
	lpvoid m_pBits;
	SkBitmap m_bitmap;
};

}

#endif